home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / aa_Intel_Only / Gnuplot / GnuplotSource / DataFilePane.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  4.0 KB  |  177 lines

  1. /*
  2.  *  Copyright (C) 1993  Robert Davis
  3.  *
  4.  *  This program is free software; you can redistribute it and/or
  5.  *  modify it under the terms of Version 2, or any later version, of 
  6.  *  the GNU General Public License as published by the Free Software 
  7.  *  Foundation.
  8.  */
  9.  
  10.  
  11. static char RCSId[]="$Id: DataFilePane.m,v 1.7 1993/05/30 09:10:07 davis Exp $";
  12.  
  13. #import <appkit/Application.h>
  14. #import <appkit/Button.h>
  15. #import <appkit/FormCell.h>
  16. #import <appkit/Matrix.h>
  17. #import <appkit/Panel.h>
  18. #import <appkit/TextFieldCell.h>
  19. #import <appkit/View.h>
  20.  
  21. #import <objc/NXStringTable.h>
  22.  
  23. #import "DataFilePane.h"
  24. #import "DataOptionsPanel.h"
  25. #import "FunctionObject.h"
  26. #import "Status.h"
  27.  
  28. @implementation DataFilePane
  29.  
  30. - init
  31. {
  32.     [super init];
  33.  
  34.     [NXApp loadNibSection: "DataFilePane.nib"
  35.             owner: self
  36.         withNames: NO
  37.          fromZone: [self zone]];
  38.  
  39.     return self;
  40. }
  41.  
  42.  
  43.  
  44. - setDetailed:sender
  45. {
  46.     struct coldat    *cd = [[doc function] columnData];
  47.     BOOL        isDetailed = [sender state];
  48.  
  49.     if (isDetailed != cd->isOn) {
  50.     cd->isOn = isDetailed;
  51.     [status reportSettingsChange:self];
  52.     if ([self forceUpdateStatus:status doc:doc])
  53.         [[infoField superview] display];
  54.     }
  55.  
  56.     return self;
  57. }
  58.  
  59.  
  60.  
  61. - setColumnsData:sender
  62. {
  63.     FunctionObject    *f = [doc function];
  64.     struct coldat    *columnData = [f columnData];
  65.     int            value = [[sender selectedCell] intValue];
  66.  
  67.  
  68.     if ((value <= columnData->number) && (value > 0)) {
  69.  
  70.     switch ([sender selectedTag]) {
  71.     case XCOL:        columnData->x = value; break;
  72.     case YCOL:        columnData->y = value; break;
  73.     case YDELTACOL:        columnData->yDelta = value; break;
  74.     case YLOWCOL:        columnData->yLow = value; break;
  75.     case YHIGHCOL:        columnData->yHigh = value; break;
  76.     case BOXWIDTHCOL:    columnData->boxWidth = value; break;
  77.     }
  78.  
  79.     [status reportSettingsChange:self];
  80.     }
  81.  
  82.     if ([self forceUpdateStatus:status doc:doc])
  83.     [[infoField superview] display];    /* Display the box */
  84.     return self;
  85. }
  86.  
  87.  
  88. - setYDiff:sender
  89. {
  90.     BOOL        useDelta = ([sender selectedTag] == USE_DELTA);
  91.     FunctionObject    *f = [doc function];
  92.     struct coldat    *columnData = [f columnData];
  93.  
  94.     if (useDelta != columnData->useYDelta) {
  95.     columnData->useYDelta = useDelta;
  96.     columnData->useYLow = !useDelta;
  97.     columnData->useYHigh = !useDelta;
  98.     [status reportSettingsChange:self];
  99.     }
  100.  
  101.     if ([self forceUpdateStatus:status doc:doc])
  102.     [[infoField superview] display];    /* Display the box */
  103.     return self;
  104. }
  105.  
  106.  
  107. - (BOOL)updateStatus:aStatus doc:aDoc
  108. {
  109.     FunctionObject    *f;
  110.  
  111.     [super updateStatus:aStatus doc:aDoc];
  112.  
  113.     f = [doc function];
  114.  
  115.     if (f) {
  116.  
  117.     struct coldat    *c = [f columnData];
  118.     char        info[1023];
  119.     BOOL        enabled = c->isOn;
  120.     int        style = [f style];
  121.     Window        *viewWindow;
  122.  
  123.     [(viewWindow = [view window]) disableDisplay];
  124.  
  125.     [detailedButton setState:enabled];
  126.  
  127.     if (c->number == 1)
  128.         strcpy (info, [stringSet valueForStringKey:"columnsInfoSingular"]);
  129.     else
  130.         sprintf (info, [stringSet valueForStringKey:"columnsInfoPlural"],
  131.              c->number);
  132.  
  133.     [infoField setStringValue: info];
  134.     [infoField setEnabled: enabled];
  135.     [infoLine2 setEnabled: enabled];
  136.  
  137.     [xColField setEnabled:(enabled && c->useX)];
  138.     [xColField setIntValue:c->x];
  139.     [yColField setEnabled:(enabled && c->useY)];
  140.     [yColField setIntValue:c->y];
  141.  
  142.     enabled = enabled && (c->number > 2);
  143.  
  144.     [boxWidthColField setEnabled:(enabled && c->useBoxWidth &&
  145.                       ((style == FUNCTION_BOXES) ||
  146.                        (style == FUNCTION_BOXERRORBARS)))];
  147.     [boxWidthColField setIntValue:c->boxWidth];
  148.  
  149.  
  150.     enabled = enabled && ((style == FUNCTION_ERRORBARS) ||
  151.                   (style == FUNCTION_BOXERRORBARS));
  152.  
  153.     [colRadioMatrix setEnabled:enabled];
  154.     [colRadioMatrix selectCellWithTag:c->useYDelta? USE_DELTA :!USE_DELTA];
  155.     [yDeltaColField setEnabled:(enabled && c->useYDelta)];
  156.     [yDeltaColField setIntValue:c->yDelta];
  157.     [yLowColField setEnabled:(enabled && c->useYLow)];
  158.     [yLowColField setIntValue:c->yLow];
  159.     [yHighColField setEnabled:(enabled && c->useYHigh)];
  160.     [yHighColField setIntValue:c->yHigh];
  161.  
  162.     [viewWindow reenableDisplay];
  163.  
  164.     }
  165.  
  166.     return YES;
  167. }
  168.  
  169.  
  170. // Shuts up the compiler about unused RCSId
  171. - (const char *) rcsid
  172. {
  173.     return RCSId;
  174. }
  175.  
  176. @end
  177.